<?php
class BookAction extends Action{

	public function _initialize() {
		header("Content-Type:text/html; charset=utf-8");

	}
	function index(){
		
		$dao = D("Book");
		
		$this->assign("list",$dao->order("create_time desc")->findAll());

		$this->display();
	}

	function add(){
		$this->display();
	}

	function insert(){
			
		$dao = D("Book");
			
		$model = $dao->create();
		
		$rs = $dao->add();
		if (!$rs) {
			exit($dao->getDbError().' [ <a href="javascript:history.back()">返 回2</a> ]');
		}
		
		$this->assign("url",__APP__.'/Book/index');
		$this->assign("message",'数据添加成功！');
		$this->success('数据添加成功！');
	}

}
?>